package com.app.widgets.dessertDemo.enviewsdemo;

import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.res.ResourcesCompat;

import com.app.widgets.R;
import com.zndroid.widget.DessertView.PileLayout;
import com.zndroid.widget.ImageView.CRImageView;

public class PileLayoutActivity extends AppCompatActivity {
    private PileLayout pileLayout;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_pile_layout);

        pileLayout = findViewById(R.id.pl);

        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(180,180);

        CRImageView imageView1 = new CRImageView(this);
        imageView1.setImageBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.head1));
        imageView1.setLayoutParams(layoutParams);
        imageView1.setCircle(true);
        imageView1.setRadius(100f);
        imageView1.setBorderColor(ResourcesCompat.getColor(getResources(), android.R.color.white, getTheme()));
        imageView1.setBorderWidth(10f);

        CRImageView imageView2 = new CRImageView(this);
        imageView2.setImageResource(R.mipmap.head2);
        imageView2.setLayoutParams(layoutParams);
        imageView2.setCircle(true);
        imageView2.setRadius(100f);
        imageView2.setBorderColor(ResourcesCompat.getColor(getResources(), android.R.color.white, getTheme()));
        imageView2.setBorderWidth(10f);

        CRImageView imageView3 = new CRImageView(this);
        imageView3.setImageResource(R.mipmap.head3);
        imageView3.setLayoutParams(layoutParams);
        imageView3.setCircle(true);
        imageView3.setRadius(100f);
        imageView3.setBorderColor(ResourcesCompat.getColor(getResources(), android.R.color.white, getTheme()));
        imageView3.setBorderWidth(10f);

        CRImageView imageView4 = new CRImageView(this);
        imageView4.setImageResource(R.mipmap.head4);
        imageView4.setLayoutParams(layoutParams);
        imageView4.setCircle(true);
        imageView4.setRadius(100f);
        imageView4.setBorderColor(ResourcesCompat.getColor(getResources(), android.R.color.white, getTheme()));
        imageView4.setBorderWidth(10f);


        pileLayout.setMax(3);
        pileLayout.pileView(imageView1);
        pileLayout.pileView(imageView2);
        pileLayout.pileView(imageView3);
        pileLayout.pileView(imageView4);
    }
}
